import { useEffect } from 'react'
import { BrowserRouter as Router } from 'react-router-dom'
import { ConfigProvider } from 'antd'
import { authService } from './api/service'
import AppRoutes from './router'

function App() {
  // 组件挂载时检查认证状态
  useEffect(() => {
    authService.checkAuthStatus()
  }, [])

  return (
    <ConfigProvider
      theme={{
        token: {
          colorPrimary: '#fe2c55',
        },
        components: {
          Menu: {
            itemSelectedColor: '#fe2c55',
            itemSelectedBg: '#fff5f7',
          },
        },
      }}
    >
      <Router>
        {/* 路由配置 */}
        <AppRoutes />
      </Router>
    </ConfigProvider>
  )
}

export default App